﻿using System;

using Microsoft.Xna.Framework;
using OakEngine.AI.Tools;

namespace MainJumpFleet.SteerBehaviors
{
   public class Seek : SteeringBehavior
    {

     public  Vector2 m_Target;

      public float m_fMaxAcceleration;

      public Seek()
          : base()
      {
      }

        public override void UpdateSteering(OakEngine.AI.Steering.Oak_Steering steer)
        {
            steer.ForwardVector = m_Target;
            steer.ForwardVector -= this.m_Agent.Position;
           
            // Check if there is a direction
            if (OAK_AITools.SquareMagnitude(steer.ForwardVector) > 0)
            {
                steer.ForwardVector = Vector2.Normalize(steer.ForwardVector);
                steer.ForwardVector *= m_fMaxAcceleration;

            }
        }
    }
}
